class Test {
    private int age;
    public String name;
    public Test(int age, String name) {
        this.age = age;
        this.name = name;
        System.out.println("这是一个构造代码块");
    }
    public Test(){

    }

    {
        name = "zc";
        System.out.println("这是一个普通代码块");
    }
    {
        name = "灿";
        System.out.println("这是另一个普通代码块");
    }
//////////////
/*    public int getAge() {
        return age;
    }*/

/*    public void setAge(int age) {
        this.age = age;
    }*/
///////////////使用generate自动生成的接口
    public void show(){
        System.out.println(name + " :" + age + "岁");
    }
}
class Working{
    public static void main(String[] args) {
//        Test test = new Test(21,"朱灿");
        Test test2 = new Test();
        System.out.println(test2.name);
    }
    public static void main1(String[] args) {
        Test test = new Test(10,"张三");
//        test.age = 19;//private 使得无法直接访问成员变量name—— 去提供一个接口使得可以继续访问
//        test.setAge(21);//接口的存在使我们仍可以改变被封装的成员变量
        test.show();
    }
}
/*
class Test {
    int age;
    String name;
    //测试内容：使用idea自动生成构造方法

    public Test(int age, String name) {
        this.age = age;
        this.name = name;
    }

    */
/*    Test(int a, String b){
            this.age = a;
            this.name = b;
        }*//*

    public void show(){
        System.out.println(name + " :" + age + "岁");
    }
}
class Working{
    public static void main(String[] args) {
        Test test = new Test(10,"张三");
        test.show();
    }
}*/
